package com.chengwt.dao.impl;

import org.hibernate.Session;
import org.hibernate.Transaction;


import com.chengwt.entity.User;
import com.chengwt.entity.UserGroup;
import com.chengwt.util.HibernateUtil;

public class UserGroupUserTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Session session =HibernateUtil.getSession();
		Transaction tx = session.beginTransaction();
		
		try {
			User u = new User();
			u.setUserName("lili");
			
			User u1 = new User();
			u1.setUserName("Mary");
			
			UserGroup ug1 = new UserGroup();
			ug1.setUserGroupName("NIhao");
			
			UserGroup ug2 = new UserGroup();
			ug1.setUserGroupName("NIhao");
			
			session.save(u);
			session.save(ug1);
			
			tx.commit();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
